﻿/*
   Advanced Flash Engine in ActionScript 3.
   Copyright (C) 2009  Dean Gardiner, Taylor Lodge

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.winmastergames.lolgame {
	import flash.display.*;
	import com.winmastergames.lolgame.*;

	public class globals extends MovieClip {
		//Variables for controlling how many powerups spawn per round.
		public static var maxPowerups:Number = 8;
		public static var powerupsThisRound:Number = 0;
		public static var damageThisRound = 0;
		public static var instaThisRound = 0;
		public static var ammoThisRound = 0;
		public static var repairThisRound = 0;
		public static var invThisRound = 0;
		public static var maxDamageThisRound = 1;
		public static var maxInstaThisRound = 1;
		public static var maxAmmoThisRound = 1;
		public static var maxRepairThisRound = 1;
		public static var maxInvThisRound = 1;
		
		public static function getDistance(x1:Number, y1:Number, x2:Number, y2:Number):Number {
			var dx:Number = x1 - x2;
			var dy:Number = y1 - y2;
			return Math.sqrt(dx * dx + dy * dy);
		}
		
		public static function convertWeaponName(weapon:String)
		{
			switch(weapon)
			{
				case "[object Glock]" :
					return "Glock";
				break;
				
				case "[object USP]" :
					return "USP";
				break;
				
				default :
					return "God";
				break;
			}
		}
		
		public static function resetPowerups()
		{
			damageThisRound = 0;
			invThisRound = 0;
			ammoThisRound = 0;
			repairThisRound = 0;
			instaThisRound = 0;
			powerupsThisRound = 0;
		}
		
		public static function findCurrentAmmoType(ammoType:String)
		{
			switch(ammoType)
			{
				case "9MM" :
					return player.ammoNineMM;
				break;
			}
		}
	}
}